package com.reptile.handle;

import com.reptile.init.AsyncService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 数据处理定时任务
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class YsProcessHandle {

    private final AsyncService asyncService;

    /**
     * 定时将图片信息同步到Redis
     */
    @XxlJob("YsReptilePicDataToRedisHandler")
    void picDataToRedis() throws Exception {
        log.info("定时将图片数据同步到redis任务开始！");
        asyncService.initYsMaterial();
        log.info("定时将图片数据同步到redis任务结束！");
    }

    /**
     * 定时将图片信息同步到Redis
     */
    @XxlJob("YsReptileDataClearProcessHandler")
    void ataClearProcess() throws Exception {
        log.info("清理重复数据开始！");
        asyncService.dataClearProcess();
        log.info("清理重复数据结束！");
    }

}
